package com.xudm.cdg.controller;

import com.xudm.cdg.api.WxYiYanApi;
import com.xudm.cdg.entity.WxYiYanResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ernie")
public class WxYiYanController {

    private final WxYiYanApi wxYiYanApi;

    public WxYiYanController(WxYiYanApi wxYiYanApi) {
        this.wxYiYanApi = wxYiYanApi;
    }

    @RequestMapping("/getAccessToken")
    public String getAccessToken() {
        return wxYiYanApi.getAccessToken();
    }

    @RequestMapping("/chatByERNIE48k")
    public WxYiYanResult chatByERNIE48k(String question) {
        return wxYiYanApi.chatByERNIE4_8k(question);
    }
}
